package com.zmn.mcc.cas.server;

import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.support.atomic.RedisAtomicInteger;

/**
 * @author quanjic
 * @version v1.0
 * @since 2020/6/18 9:28
 **/
public class RedisAtomicFactory {

    private RedisConnectionFactory redisConnectionFactory;

    public RedisAtomicFactory(RedisConnectionFactory redisConnectionFactory) {
        this.redisConnectionFactory = redisConnectionFactory;
    }

    /**
     *
     * @param key redis key
     * @return
     */
    public RedisAtomicInteger create(String key){

        return new RedisAtomicInteger(key, redisConnectionFactory);
    }

}
